message = "我是一个字符串"
data = message.encode("utf-8")
# 打开一个文件
file_object = open("log.txt", mode="wb")
# 写内容
file_object.write(data)
# 关闭文件
file_object.close()

name = "张坤"
print(name)
data_utf8 = name.encode("utf-8")
data_gbk = name.encode("gbk")
print(data_utf8)
print(data_gbk)
old_utf8 = data_utf8.decode("utf-8")
old_gbk = data_gbk.decode("gbk")
print(old_utf8)
print(old_gbk)


name = "寮犲潳"
print(name)
data_gbk = name.encode("gbk")
print(data_gbk)
old_utf8 = data_gbk.decode("utf-8")
print(old_utf8)
